
<%= error_messages_for 'user' %>

<div class=input>
<table class=input border=1>
<tr><td colspan=2><h2>
  <%="Add a person to the".t%> <%=@cur_user.company.name%>
  <%=" - " + @project.name if @project%>
  </h2>
</td></tr>
<tr>
<%if @project%>
<td width=40% valign=top><%="Choose an existing user".t%>:
  <div id=us_no>
   <%=render :partial=>'us_no',:locals=>{:us_no=>@us_no,:project_id=>params[:project_id]}%>
  <div>
</td>
<%end%>
<td ><%="Add a new person".t%>:
<%form_remote_for :user,:url=>{:action => 'create'} do %>
<table>
<%if Globalize::Locale.language.to_s == "Chinese"%>
<tr><td><label for="user_name"><%='Last Name'.t%><%='First Name'.t%>:</label></td>
<td><%= text_field 'user', 'last_name', :size => 20  %></td></tr>
<%else%>
<tr><td><label for="user_name"><%='Last Name'.t%>:</label></td>
<td><%= text_field 'user', 'last_name', :size => 20  %></td></tr>
<tr><td><label for="user_name"><%='First Name'.t%>:</label></td>
<td><%= text_field 'user', 'first_name', :size => 20  %></td></tr>
<%end%>

<tr><td width=15%><label for="user_name"><%='User Name'.t%>:</label></td>
<td><%= text_field 'user', 'username',:value=>'', :style =>'width:200px'%>*(<%='MUST'.t%>)</td></tr>

<tr><td><label for="user_password"><%='Password'.t%>:</label></td>
<td><%= password_field 'user', 'password',:value=>'',:style=>'width:200px'%>*(<%='MUST'.t%>)
</td></tr>
<tr><td><label for="user_name"><%='Email'.t%>:</label></td>
<td>
   <%=text_field 'user', 'email', :size => 35  %>
   <%=hidden_field_tag 'project_id', :value=>params[:project_id]%>
   (<span class=intro_txt><%="System will send an email".t%></span>)
</td></tr>
<%if !@project%>
<tr><td><label for="user_name"><%='Project'.t%>:</label></td>
<td>
<%@cur_user.company.active_projects.each do |p|%>
  <%=check_box_tag "project_ids[]",p.id,true,:class=>'all'%><%=p.name%>
<%end%>
</td></tr>
<%end%>
<tr><td><label for="language"><%='Language'.t%>:</label></td>
<td><%= select 'user','lang',LANGTYPES%>
</td></tr>
<tr><td></td><td>
       <%= submit_tag "Create and add person".t,:onclick=>"Element.show('indicator')"%> <%="or".t%> <a href=# class="admin" onclick="Effect.BlindUp('new_user',{duration:0.2});"><%='Cancel'.t%></a>
     <span id='indicator' style="display:none;text-align:center;margin:0px;padding:0px;width:100%;">
       <%=image_tag "indicator.gif",:border=>0%>
     </span>
<%end%>
</td></tr>
</table>
</td></tr>
</table>
</div>
